package com.nate.tasking.actions;

import javax.jdo.PersistenceManager;

import org.apache.log4j.Logger;

import com.nate.tasking.data.PMF;
import com.nate.tasking.domain.User;
import com.opensymphony.xwork2.ActionSupport;

public class DeleteUserAction extends ActionSupport{

	private static final long serialVersionUID = 6390974667995625397L;
	private final Logger logger = Logger.getLogger(DeleteUserAction.class);
	private User user;

	public String execute(){
		logger.debug("Delete User Action");
		
		PersistenceManager pm = PMF.get().getPersistenceManager();
    	try {
    	    pm.deletePersistent(user);
            logger.debug("deleted user " + user.getUsername());
        } finally {
            pm.close();
        }
		return SUCCESS;
	}
	
	
	public User getUser() {
		return user;
	}

	public void setUser(User users) {
		this.user = users;
	}
}
